package com.java.module.fire.controller.admin;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.java.common.lang.annotation.Log;
import com.java.common.lang.domain.AjaxResult;
import com.java.common.lang.enums.BusinessTypeEnum;
import com.java.common.utils.WebKit;
import com.java.module.fire.domain.Vip;
import com.java.module.fire.service.IVipService;
import com.java.common.utils.poi.ExcelUtil;
import com.java.common.lang.domain.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 * 
 * @author Administrator
 * @date 2025-06-19
 */
@RestController("AdminVipController")
@RequestMapping("/fire/vip")
public class VipController {
    @Autowired
    private IVipService vipService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('fire:vip:list')")
    @GetMapping("/list")
    public TableDataInfo list(Vip vip) {
        WebKit.startPage();
        List<Vip> list = vipService.selectVipList(vip);
        return WebKit.getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('fire:vip:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessTypeEnum.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Vip vip) {
        List<Vip> list = vipService.selectVipList(vip);
        ExcelUtil<Vip> util = new ExcelUtil<Vip>(Vip.class);
        return util.exportExcel(list, "vip");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('fire:vip:query')")
    @GetMapping(value = "/{vipId}")
    public AjaxResult getInfo(@PathVariable("vipId") Long vipId) {
        return AjaxResult.success(vipService.selectVipById(vipId));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('fire:vip:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessTypeEnum.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Vip vip) {
        return WebKit.toAjax(vipService.insertVip(vip));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('fire:vip:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessTypeEnum.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Vip vip) {
        return WebKit.toAjax(vipService.updateVip(vip));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('fire:vip:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessTypeEnum.DELETE)
	@DeleteMapping("/{vipIds}")
    public AjaxResult remove(@PathVariable Long[] vipIds) {
        return WebKit.toAjax(vipService.deleteVipByIds(vipIds));
    }
}
